<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">产品信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{commProductIdInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form" rendered="#{commProductIdInfoBean.isView()}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{commProductIdInfoBean.onSave()}"
                                         update="@form"
                                         rendered="#{commProductIdInfoBean.isAdd() || commProductIdInfoBean.isEdit()}"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="ui-g-12 card">
                        <h1>基础信息</h1>

                        <div class="ui-g-12">
                            <div class="ui-g-2">
                                <p:outputLabel value="产品ID"/>
                            </div>
                            <div class="ui-g-4">
                                <p:inputText id="productId" value="#{commProductIdInfoBean.$.productId}"
                                             disabled="#{commProductIdInfoBean.isView()}"/>
                            </div>
                            <div class="ui-g-2">
                                <p:outputLabel value="真实产品ID"/>
                            </div>
                            <div class="ui-g-4">
                                <p:inputText id="realPrdid" value="#{commProductIdInfoBean.$.realPrdid}"
                                             disabled="#{commProductIdInfoBean.isView()}"/>
                            </div>
                            <div class="ui-g-2">
                                <p:outputLabel value="产品名称"/>
                            </div>
                            <div class="ui-g-4">
                                <p:inputText id="name" value="#{commProductIdInfoBean.$.name}"
                                             disabled="#{commProductIdInfoBean.isView()}"/>
                            </div>
                            <div class="ui-g-2">
                                <p:outputLabel value="原生应用"/>

                            </div>
                            <div class="ui-g-4">
                                <p:selectOneRadio id="console" value="#{commProductIdInfoBean.$.isApp}"
                                                  disabled="#{commProductIdInfoBean.isView()}">
                                    <f:selectItem itemLabel="是" itemValue="1" />
                                    <f:selectItem itemLabel="否" itemValue="0" />
                                </p:selectOneRadio>

                            </div>
                            <div class="ui-g-2">
                                <p:outputLabel value="所属大产品"/>
                            </div>
                            <div class="ui-g-4">
                                <p:selectOneMenu id="parentId" value="#{commProductIdInfoBean.$.parentId}"
                                                 disabled="#{commProductIdInfoBean.isView()}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                  noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{commProductIdInfoBean.dictionaries[DictionaryCode.LARGE_COMMON_PRODUCT]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>





                            <div class="ui-g-2">
                                <p:outputLabel value="备注"/>
                            </div>
                            <div class="ui-g-4">
                                <p:inputText id="memo" value="#{commProductIdInfoBean.$.memo}"
                                             disabled="#{commProductIdInfoBean.isView()}"/>
                            </div>

                            <div class="ui-g-2">
                                <p:outputLabel value="外推页logo" />
                            </div>
                            <div class="ui-g-1">
                                <p:graphicImage url="#{commProductIdInfoBean.$.extraLogo}" width="80" />
                            </div>
                            <div class="ui-g-3">
                                <p:fileUpload fileUploadListener="#{commProductIdInfoBean.onUploadExtraLogo}"
                                              mode="advanced"
                                              fileLimit="1"
                                              auto="true"
                                              fileLimitMessage="只能上传一个文件"
                                              invalidFileMessage="不支持上传文件类型"
                                              invalidSizeMessage="文件过大"
                                              sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                              allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                                              label="上传" update="@form" process="@form"
                                              disabled="#{commProductIdInfoBean.isView()}" />
                            </div>

                            <div class="ui-g-12 padding0">
                                <div class="ui-g-2">
                                    <p:outputLabel value="产品下载链接"/>
                                </div>
                                <div class="ui-g-10">
                                    <p:inputText id="downloadUrl" value="#{commProductIdInfoBean.$.downloadUrl}"
                                                 disabled="#{commProductIdInfoBean.isView()}"/>
                                </div>
                            </div>
                            <div class="ui-g-12 padding0">
                                <div class="ui-g-2">
                                    <p:outputLabel value="微信下(android产品)下载链接"/>
                                </div>
                                <div class="ui-g-10">
                                    <p:inputText id="wxDownloadUrl" value="#{commProductIdInfoBean.$.wxDownloadUrl}"
                                                 disabled="#{commProductIdInfoBean.isView()}"/>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>